package config

import (
	"github.com/spf13/viper"
	"log"
)

type Config struct {
	Mysql
	InitRabbitMq
	Baidu
}

type Mysql struct {
	Host     string
	Port     string
	User     string
	Password string
	Database string
}

type InitRabbitMq struct {
	User     string
	Password string
	Vhost    string
}

type Baidu struct {
	Ak string
	Sk string
}

var ConFig Config

func Init() {
	viper.SetConfigFile("config/dev.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&ConFig)
	log.Println("动态读取配置成功", ConFig)
}
